<template>
    <div class="sm-workUnpackInfoTable">
        <el-table
        ref="receiveTable"
        size="mini"
        :data="resData"
        style="width: 100%"
        height="350"
        @selection-change="chooseUnpackInfo"
        >
        <el-table-column type="selection" width="40"></el-table-column>
        <el-table-column type="index" label="序号" width="50" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="packageCode" width="160" label="工作包编码" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="workbinCode" width="160" label="缓存箱编号" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="toolCode" width="160" label="工作包编号" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="packageCount" label="分拣数量" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="itemQty" label="需求数量" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="unpackQty" label="拆分数量" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="artChangeTypeName" width="160" label="类型" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="aoCode" width="160" label="ao编码" :show-overflow-tooltip="true" > </el-table-column>
        <el-table-column prop="itemCode" width="160" label="图号" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="qualityCode" width="160" label="质量编码" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="msTaskPackageId"  label="工作包ID"  :show-overflow-tooltip="true"> </el-table-column>

        
      </el-table>
        <!-- 分页 -->
        <el-pagination
        layout="prev, pager, next"
        :total="totalCount"
        :page-size="pageSize"
        @current-change="handleCurrentChange"
        >
        </el-pagination>
    </div>
</template>
<script>
import { unpackToolDetailedInfo } from "@/utils/api.js";
export default {
    name:'workUnpackInfoTable',
    data(){
        return {
            // 当前页数
            pageNumber: 1,
            // 数据总个数
            totalCount: 0,
            // 返回的数据数组
            resData: [],
            // 每页数据个数
            pageSize: 20,
            // 确认列表高亮参数
            stableIndex: 0,
            value: "",
            ss: "",
        }
    },
    methods:{
        handleCurrentChange(val) {
            this.pageNumber = val;
            unpackToolDetailedInfo({
                pageParameter: {
                rows: this.pageSize,
                page: this.pageNumber,
                },
            }).then((res) => {
                this.resData = res.data.responseBody.result;
                this.totalCount = res.data.responseBody.pageParameter.totalCount;
            });
        },
        chooseUnpackInfo(val){
            this.currentRow = val;
            console.log(val)
            this.$bus.$emit('getDoUnpackInfo',val)
        }
    },
    mounted() {
         unpackToolDetailedInfo({
             pageParameter: {
             rows: this.pageSize,
             page: this.pageNumber,
             },
         }).then((res) => {
             console.log('工作包拆包info表1',res)
             this.resData = res.data.responseBody.result;
             this.totalCount = res.data.responseBody.pageParameter.totalCount;
            
         });

        this.$bus.$on('searchUnpackDetailedInfo',(e)=>{
            this.msTaskPackageId = e
            unpackToolDetailedInfo({
                msTaskPackageId:this.msTaskPackageId,
                pageParameter: {
                rows: this.pageSize,
                page: this.pageNumber,
                },
            }).then((res) => {
                this.resData = res.data.responseBody;
                // this.totalCount = res.data.responseBody.pageParameter.totalCount;
                console.log('工作包详细信息表',res)
            });
        });

        //
  }
}
</script>
<style scoped>
.sm-workUnpackInfoTable {
    width: 100%;
    height: 220px;
    text-align: center;
}
</style>